﻿@using OBUCare.Web.Infrastructure;
@model IEnumerable<OBUCare.Core.Models.DICT_TYPE>

@{
    ViewBag.Title = "元数据配置";
}

<center>
    <h2 >@ViewBag.Title</h2>
</center>

@(Html.Telerik().Grid(Model)
        .Name("Grid")
        .DataKeys(keys => keys.Add(c => c.ID))
            .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.ImageAndText).Text("添加"))
        .DataBinding(dataBinding => dataBinding
            .Server()
            .Insert("Insert", "DictType")
            .Update("Update", "DictType")
            .Delete("Delete", "DictType")
                    )
        .Columns(columns =>
        {
            columns.Bound(o => o.ID);
            columns.Bound(o => o.TYPE_NAME);            
            columns.Bound(o => o.REMARK);
            columns.Template(
                @<text>
                    @Html.ActionLink("列表项", "Index", "DictTypeValues", new { id = item.ID }, null)
                </text>
            ).Title("列表项");
            columns.Command(commands =>
            {
                commands.Edit().ButtonType(CommonStyleForUI.Grid_ButtuonType).Text("编辑");
                //commands.Delete().ButtonType(CommonStyleForUI.Grid_ButtuonType).Text("删除");
            }).Title("编辑");
            columns.Command(commands =>
            {
                //commands.Edit().ButtonType(CommonStyleForUI.Grid_ButtuonType).Text("编辑");
                commands.Delete().ButtonType(CommonStyleForUI.Grid_ButtuonType).Text("删除");
            }).Title("删除");
            
        })
        .Editable(editing => editing.Mode(GridEditMode.InForm))
        //.TemplateName("Editor")
        .Pageable(paging => paging.Style(CommonStyleForUI.Grid_PageStyle).Position(CommonStyleForUI.Grid_PagePosition).PageTo(CommonStyleForUI.Grid_CurrentPage).PageSize(CommonStyleForUI.Grid_PageSize))
        .Selectable()
        )


@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}